package memnet.graph.search;

import java.util.List;

import memnet.graph.Edge;

public class SearchResult implements Comparable<SearchResult>{
	public final List<Edge> path;
	public final double backCost;
	public final double forwardCost;
	
	SearchResult(Object node,  List<Edge> path,double bcost, double fcost){
		this.path = path;
		this.backCost = bcost;
		this.forwardCost = fcost;
	}
	
	public Edge lastEdge(){
		return path.get(path.size()-1);
	}
	
	public void removeHead(){
		path.remove(0);
	}
	
	@Override
	public int compareTo(SearchResult o) {
		return Double.compare(backCost+forwardCost, o.backCost+o.forwardCost);
	}
	
	public String toString(){
		return backCost+"{"+path+"}";
	}
}